package com.example.controller;

import com.example.domain.ResponseResult;
import com.example.domain.vo.FileVo;
import com.example.service.FileService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author hlc
 * @version 1.0
 * @date 2022/10/12 9:34
 */
@RestController
@RequestMapping("/file")
public class FileController {
    private final FileService fileService;

    public FileController(FileService fileService) {
        this.fileService = fileService;
    }

    @PostMapping("/upload")
    public ResponseResult<FileVo> uploadImage(MultipartFile file) {
        return fileService.uploadImage(file);
    }
}
